webpackJsonp([63],{

/***/ "fIHr":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/regenerator/index.js
var regenerator = __webpack_require__("lC5x");
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/extends.js
var helpers_extends = __webpack_require__("4YfN");
var extends_default = /*#__PURE__*/__webpack_require__.n(helpers_extends);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__("J0Oq");
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);

// EXTERNAL MODULE: ./src/store/index.js
var store = __webpack_require__("IcnI");

// EXTERNAL MODULE: ./src/common/api/commonApi.js
var commonApi = __webpack_require__("+/+p");

// EXTERNAL MODULE: ./node_modules/_lodash@4.17.11@lodash/lodash.js
var lodash = __webpack_require__("psq8");
var lodash_default = /*#__PURE__*/__webpack_require__.n(lodash);

// CONCATENATED MODULE: ./node_modules/_babel-loader@7.1.5@babel-loader/lib!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=script&index=0!./src/common/anjian/todo/list.vue



//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//





/* harmony default export */ var list = ({
  data: function data() {
    return {
      items: []
    };
  },

  computed: {
    itemsObj: function itemsObj() {
      return lodash_default.a.groupBy(this.items, 'todo_category');
    }
  },
  activated: function activated() {
    this.initData();
    this.onSubscribe();
  },
  deactivated: function deactivated() {
    this.onUnsubscribe();
  },

  methods: {
    initData: function initData() {
      var _this = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee() {
        var user, roles, fn, options;
        return regenerator_default.a.wrap(function _callee$(_context) {
          while (1) {
            switch (_context.prev = _context.next) {
              case 0:
                user = Object(store["c" /* GetStore */])(store["f" /* Store */].user);
                roles = Object(store["c" /* GetStore */])(store["f" /* Store */].roles);

                fn = function fn(object) {
                  if (object.todo_state !== 0) {
                    return false;
                  } else {
                    if (object.todo_id && object.todo_id.indexOf(user.id) > -1) {
                      return true;
                    } else {
                      if (object.todo_role && object.todo_role.length) {
                        var obj = roles.find(function (v) {
                          return object.todo_role.indexOf(v) > -1;
                        });
                        return !!obj;
                      }
                      return false;
                    }
                  }
                };

                _this.subscription = commonApi["a" /* commonApi */].liveQuery('sys_todo');
                _this.subscription.on('create', function (object) {
                  object = extends_default()({ id: object.id }, object.attributes);
                  if (fn(object)) {
                    _this.items.push(object);
                  }
                });
                _this.subscription.on('update', function (object) {
                  object = extends_default()({ id: object.id }, object.attributes);
                  var index = _this.items.findIndex(function (v) {
                    return v.id === object.id;
                  });
                  if (index > -1) {
                    if (fn(object)) {
                      _this.items.splice(index, 1, object);
                    } else {
                      _this.items.splice(index, 1);
                    }
                  }
                });
                options = {
                  and: [{
                    or: [{ containedIn: { todo_role: roles.map(function (v) {
                          return v.name;
                        }) } }, { containedIn: { todo_id: [user.id] } }]
                  }, {
                    notContainedIn: { todo_category: ['综合考评', '其他'] }
                  }, {
                    equalTo: { todo_state: 0 },
                    limit: 1000
                  }]
                };
                _context.next = 9;
                return commonApi["a" /* commonApi */].search('sys_todo', options);

              case 9:
                _this.items = _context.sent;

              case 10:
              case 'end':
                return _context.stop();
            }
          }
        }, _callee, _this);
      }))();
    },
    onSubscribe: function onSubscribe() {
      var _this2 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee2() {
        return regenerator_default.a.wrap(function _callee2$(_context2) {
          while (1) {
            switch (_context2.prev = _context2.next) {
              case 0:
                _this2.subscribe = commonApi["a" /* commonApi */].liveQuery('sys_todo');
                _this2.subscribe.on('create', function (object) {
                  object = extends_default()({ id: object.id }, object.attributes);
                  _this2.items.push(object);
                });
                _this2.subscription.on('update', function (object) {
                  object = extends_default()({ id: object.id }, object.attributes);
                  var index = _this2.items.findIndex(function (v) {
                    return v.id === object.id;
                  });
                  if (index > -1) {
                    _this2.items.splice(index, 1, object);
                  }
                });

              case 3:
              case 'end':
                return _context2.stop();
            }
          }
        }, _callee2, _this2);
      }))();
    },
    onUnsubscribe: function onUnsubscribe() {
      var _this3 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee3() {
        return regenerator_default.a.wrap(function _callee3$(_context3) {
          while (1) {
            switch (_context3.prev = _context3.next) {
              case 0:
                _this3.subscribe.unsubscribe();

              case 1:
              case 'end':
                return _context3.stop();
            }
          }
        }, _callee3, _this3);
      }))();
    },
    goDetail: function goDetail(item) {
      if (item.todo_category === '行政执法') {
        this.$router.$push('/law');
      } else if (item.todo_category === '收发文件' || item.todo_category === '通知公告' || item.todo_category === '会议通知') {
        this.$router.$push('/message');
      } else if (item.todo_category === '企业隐患排查') {
        this.$Toast('请登录pc端系统，及时处理！');
        this.$router.$push('/dangerCheck');
      } else if (item.todo_category === '特殊作业') {
        this.$router.$push('/special-work');
      } else if (item.todo_category === '企业注册审核') {
        this.$router.$push('/company/register');
      } else {
        // 其他类型暂不支持
      }
    }
  }
});
// CONCATENATED MODULE: ./node_modules/_vue-loader@13.7.3@vue-loader/lib/template-compiler?{"id":"data-v-04fab3ef","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=template&index=0!./src/common/anjian/todo/list.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('yt-page',{attrs:{"title":"待办事项","scroll":""}},_vm._l((_vm.items),function(item,index){return _c('yt-cell',{key:index,attrs:{"label":item.todo_content,"labelWidth":"70%","isLink":"","border":"all"},on:{"click":function($event){return _vm.goDetail(item)}}},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(item.todo_category === '企业隐患排查'),expression:"item.todo_category === '企业隐患排查'"}],staticClass:"circle bg-orange",attrs:{"slot":"icon"},slot:"icon"},[_c('span',{staticClass:"iconfont icon-danger"})]),_vm._v(" "),_c('div',{directives:[{name:"show",rawName:"v-show",value:(item.todo_category === '收发文件'),expression:"item.todo_category === '收发文件'"}],staticClass:"circle bg-light-blue",attrs:{"slot":"icon"},slot:"icon"},[_c('span',{staticClass:"iconfont icon-tools"})]),_vm._v(" "),_c('div',{directives:[{name:"show",rawName:"v-show",value:(item.todo_category === '通知公告'),expression:"item.todo_category === '通知公告'"}],staticClass:"circle bg-purple",attrs:{"slot":"icon"},slot:"icon"},[_c('span',{staticClass:"iconfont icon-message"})]),_vm._v(" "),_c('div',{directives:[{name:"show",rawName:"v-show",value:(item.todo_category === '会议通知'),expression:"item.todo_category === '会议通知'"}],staticClass:"circle bg-blue",attrs:{"slot":"icon"},slot:"icon"},[_c('span',{staticClass:"iconfont icon-team"})]),_vm._v(" "),_c('div',{directives:[{name:"show",rawName:"v-show",value:(item.todo_category === '行政执法' || item.todo_category === '执法任务'),expression:"item.todo_category === '行政执法' || item.todo_category === '执法任务'"}],staticClass:"circle bg-green",attrs:{"slot":"icon"},slot:"icon"},[_c('span',{staticClass:"iconfont icon-law"})]),_vm._v(" "),_c('div',{directives:[{name:"show",rawName:"v-show",value:(item.todo_category === '特殊作业'),expression:"item.todo_category === '特殊作业'"}],staticClass:"circle bg-red",attrs:{"slot":"icon"},slot:"icon"},[_c('span',{staticClass:"iconfont icon-machine-2"})]),_vm._v(" "),_c('div',{directives:[{name:"show",rawName:"v-show",value:(item.todo_category === '企业注册审核'),expression:"item.todo_category === '企业注册审核'"}],staticClass:"circle bg-blue",attrs:{"slot":"icon"},slot:"icon"},[_c('span',{staticClass:"iconfont icon-company"})])])}),1)}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var todo_list = (esExports);
// CONCATENATED MODULE: ./src/common/anjian/todo/list.vue
function injectStyle (ssrContext) {
  __webpack_require__("kou9")
}
var normalizeComponent = __webpack_require__("C7Lr")
/* script */


/* template */

/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = "data-v-04fab3ef"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  list,
  todo_list,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

/* harmony default export */ var anjian_todo_list = __webpack_exports__["default"] = (Component.exports);


/***/ }),

/***/ "kou9":
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin

/***/ })

});